/**
 * Copyright 2015-2016 org.lychee.com 
 * All rights reserved.
 *
 * @project
 * @author pro
 * @version 1.0
 * @date 2016-03-07
 */
package com.eyaomall.wxmall.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eyaomall.wxmall.dao.MemberDao;
import com.eyaomall.wxmall.model.po.Member;
import com.eyaomall.wxmall.service.MemberService;
import com.lycheeframework.core.cmp.kit.IHTTPObject;
import com.lycheeframework.core.cmp.kit.Pages;
@Service
public class MemberServiceImpl implements MemberService {

	@Autowired
	private MemberDao memberDao;
	
	/**
	 * 分页查询注册会员信息
	 */
	public Pages<List<Member>> page(Member member, IHTTPObject httpObj) {
		
		return memberDao.page(member, httpObj);
	}

	/**
	 * 修改注册会员信息
	 */
	public boolean update(Member member) {
		
		return memberDao.update(member);
	}

	/**
	 * 查询注册会员信息
	 */
	public Member query(Member member) {
		
		return memberDao.query(member);
	}

	/**
	 * 删除注册会员信息
	 */
	public boolean delete(Integer memberId) {
		
		return memberDao.delete(memberId);
	}
	
	/**
	 * 根据店铺ID和微信公众号ID查询唯一值
	 * @param openId
	 * @param shopId
	 * @return
	 */
	public Member queryById(String openId,Integer shopId){
		Member member = new Member();
		member.setWxOpenId(openId);
		member.setShopId(shopId);
		
		return memberDao.query(member);
	}
	
	/**
	 * 新增注册会员信息
	 * @param member
	 * @return
	 */
	public Integer create(Member member){
		memberDao.insert(member);
		
		return member.getId();
	}
}
